import java.io.File;

/**
 * @ClassName FileDemo01
 * @Description TODO
 * @Author Li
 * @Date 2022/8/10 9:31
 * @ModifyDate 2022/8/10 9:31
 * @Version 1.0
 */
public class FileDemo01 {
    public static void main(String[] args) {
        // 文件名路径
        String pathname1 = "D:\\a.txt";
        File file1 = new File(pathname1);

        // 文件路径名
        String pathname2 = "D:\\A\\a.txt";
        File file2 = new File(pathname2);

        // 通过父路径和子路径字符串
        String parent = "D:\\B";
        String child1 = "b.txt";
        File file3 = new File(parent, child1);

        // 通过父级File对象和子路径字符串
        File parentDir = new File("D:\\C");
        String child2 = "c.txt";
        File file4 = new File(parentDir, child2);
    }
}
